{extends 'base/site2.html'}
{block name="page_header"}{include file="common/header.html" inline}{/block}
{block name="page_nav"}{include file="common/slide-nav.html" inline}{/block}
{block name="page_styles"}
<link rel="stylesheet" type="text/css" href="/css/mediation/caserecord/index.css" />
<style>
    :not(.input-group)>.bootstrap-select.form-control:not([class*=col-]){
        width: 100%;
    }
</style>
{/block}

{block name="page_section"}
<div class="sessionPage">
    <div class="page-header">
        <div class="left">
            <span class="line"></span>
            <strong class="tit">案件记录</strong>
        </div>
    </div>
    <form class="small-style" method="get" action=""  id="form-ele" role="validform" enctype="multipart/form-data">
        <input type="hidden" name="is_show" class="showmoreishow" value="{if $is_show == 1}1{else}0{/if}">

        <div class="form_row">
            <div class="form-group col-lg-3 ui-select">
                <label for="exampleInputName2"  class="col-sm-4 control-label">调解部门:</label>
                <div class="col-sm-7">
                    <select class="form-control" name="mediationOrganId">
                        <option class="u144_input_option"  {if $query.mediationOrganId=='0'}selected="selected"{/if} value="0">全部</option>
                        {foreach from=$mediationOrgan item=item key=key}
                        <option class="u144_input_option" {if $query.mediationOrganId==$key}selected="selected"{/if} value="{$key}">{$item.name}</option>
                        {/foreach}
                    </select>
                </div>
            </div>
            <div class="form-group col-lg-3 ui-select">
                <label for="exampleInputName2"  class="col-sm-4 control-label">资产方:</label>
                <div class="col-sm-7">
                    <select class="form-control selectpicker"   title="请选择" name="assetsId" id="assetsId">
                        {foreach from=$assets  item=info}
                        <option class="u144_input_option" {if !empty($query.assetsId) &&  $info.id == $query.assetsId}selected="selected"{/if} value="{$info.id}">{$info.name}</option>
                        {/foreach}
                    </select>
                </div>
            </div>
            <div class="form-group col-lg-3 ui-select">
                <label for="exampleInputName2"  class="col-sm-4 control-label">案件号:</label>
                <div class="col-sm-7">
                    <input type="text" class="form-control noempty col-sm-4" value="{$query.case_id}" name="case_id" id="case_id"  placeholder="请输入~">
                </div>
            </div>

            <div class="form-group col-lg-3 ui-select">
                <label for="exampleInputName2"  class="col-sm-4 control-label">当事人:</label>
                <div class="col-sm-7">
                    <input type="text" class="form-control"  name="litigantName" value="{if isset($query.litigantName)}{$query.litigantName}{/if}" placeholder="当事人姓名">
                </div>
            </div>
        </div>
        <div class="form_row">
            <div class="form-group col-lg-3 ui-select">
                <label for="exampleInputName2"  class="col-sm-4 control-label">系统状态:</label>
                <div class="col-sm-7">
                    <select class="form-control selectpicker"   title="请选择" name="sysStatus" id="sysStatus">
                        {foreach from=$sysStatus key=key  item=info}
                        <option class="u144_input_option" {if !empty($query.sysStatus) &&  $key == $query.sysStatus}selected="selected"{/if} value="{$key}">{$info}</option>
                        {/foreach}
                    </select>
                </div>
            </div>
            <div class="form-group col-lg-3 ui-select">
                <label for="exampleInputName2"  class="col-sm-4 control-label">案件状态:</label>
                <div class="col-sm-7">
                    <select class="form-control" name="caseStatus" role-ele="status" >
                        <option class="u144_input_option" {if $query.caseStatus == 0} selected="selected" {/if} value="0" }>全部</option>
                        {if $caseStatusArr}
                        {foreach from=$caseStatusArr key=id item=info}
                        <option class="u144_input_option" value="{$id}"  {if $query.caseStatus === $id}selected="selected"{/if}>{$info}</option>
                        {/foreach}
                        {/if}
                    </select>
                </div>
            </div>

            <div class="form-group col-lg-3 ui-select">
                <label for="exampleInputName2"  class="col-sm-4 control-label">调解状态:</label>
                <div class="col-sm-7">
                    <select class="form-control selectpicker"   title="请选择" name="mediateStatus" id="mediateStatus">
                        {foreach from=$mediateStatus key=key  item=info}
                        <option class="u144_input_option" {if !empty($query.mediateStatus) &&  $key == $query.mediateStatus}selected="selected"{/if} value="{$key}">{$info}</option>
                        {/foreach}
                    </select>
                </div>
            </div>
            <div class="form-group col-lg-3 ui-select">
                <label for="exampleInputName2"  class="col-sm-4 control-label">调解员:</label>
                <div class="col-sm-7">
                    <select class="form-control" id="is_contrast" name="mediatorId">
                        <option class="u144_input_option" {if $query.mediatorId==0}selected="selected"{/if} value="0">全部</option>
                        {foreach from=$mediator item=item }
                        {if $item.id != 1}
                        <option class="u144_input_option" {if $query.mediatorId == $item.id}selected="selected"{/if} value="{$item.id}">{$item.name}</option>
                        {/if}
                        {/foreach}
                    </select>
                </div>
            </div>
        </div>
        <div class="form_row start-hide col-lg-12" data-isshow="{if $is_show == 1}true{else}false{/if}" {if $is_show == 1}style="padding:0px;"{else}style="padding:0px;display:none;"{/if}>
        <div class="form-group col-lg-3 ui-select">
            <label class="col-sm-4 control-label">
                入库时间:
            </label>
            <div class="col-sm-7">
                <input data-ele="date" data-type="daterange" name="add_begin_end" class="form-control" placeholder="请选择" value="{if !empty($smarty.get.add_begin_end)}{$smarty.get.add_begin_end}{/if}" autocomplete="off"/>
            </div>
        </div>
        <div class="form-group col-lg-3 ui-select">
            <label for="exampleInputName2"  class="col-sm-4 control-label">超期时间:</label>
            <div class="col-sm-7">
                <select class="form-control" name="mediate_expire_time" id="mediate_expire_time">
                    <option class="u144_input_option" {if $query.mediate_expire_time==0}selected="selected"{/if} value="0">请选择</option>
                    <option class="u144_input_option" {if $query.mediate_expire_time==1}selected="selected"{/if} value="1">今天</option>
                    <option class="u144_input_option" {if $query.mediate_expire_time==2}selected="selected"{/if} value="2">近2天内</option>
                    <option class="u144_input_option" {if $query.mediate_expire_time==3}selected="selected"{/if} value="3">近3天内</option>
                    <option class="u144_input_option" {if $query.mediate_expire_time==5}selected="selected"{/if} value="5">近5天内</option>
                    <option class="u144_input_option" {if $query.mediate_expire_time==10}selected="selected"{/if} value="10">近10天内</option>
                    <option class="u144_input_option" {if $query.mediate_expire_time==10}selected="selected"{/if} value="999">已超期</option>
                </select>
            </div>
        </div>
        <div class="form-group col-lg-3 ui-select">
            <label for="exampleInputName2"  class="col-sm-4 control-label">移动复联状态:</label>
            <div class="col-sm-7">
                <select class="form-control" name="ydRepairStatus" id="ydRepairStatus">
                    <option class="u144_input_option" {if $query.ydRepairStatus==0}selected="selected"{/if} value="0">全部</option>
                    <option class="u144_input_option" {if $query.ydRepairStatus==1}selected="selected"{/if} value="1">修复成功</option>
                    <option class="u144_input_option" {if $query.ydRepairStatus==2}selected="selected"{/if} value="2">修复失败</option>

                </select>
            </div>
        </div>
        <div class="form-group col-lg-3 ui-select">
            <label for="exampleInputName2"  class="col-sm-4 control-label">联通复联状态:</label>
            <div class="col-sm-7">
                <select class="form-control" name="ltRepairStatus" id="ltRepairStatus">
                    <option class="u144_input_option" {if $query.ltRepairStatus==0}selected="selected"{/if} value="0">全部</option>
                    <option class="u144_input_option" {if $query.ltRepairStatus==1}selected="selected"{/if} value="1">修复成功</option>
                    <option class="u144_input_option" {if $query.ltRepairStatus==2}selected="selected"{/if} value="2">修复失败</option>

                </select>
            </div>
        </div>
</div>
<div class="form_row start-hide col-lg-12" data-isshow="{if $is_show == 1}true{else}false{/if}" {if $is_show == 1}style="padding:0px;"{else}style="padding:0px;display:none;"{/if}>
<div class="form-group col-lg-3 ui-select">
    <label for="exampleInputName2"  class="col-sm-4 control-label">用户标签:</label>
    <div class="col-sm-7">
        <select class="form-control selectpicker"   title="请选择"  name="customLabel[]" id="customLabel" multiple>
            {foreach from=$customLabel key=key  item=info}
            <option class="u144_input_option" {if !empty($query.customLabel) &&  in_array($key , $query.customLabel)}selected="selected"{/if} value="{$key}">{$info}</option>
            {/foreach}
        </select>
    </div>
</div>
<div class="form-group col-lg-3 ui-select">
    <label for="exampleInputName2"  class="col-sm-4 control-label">用户等级:</label>
    <div class="col-sm-7">
        <select class="form-control selectpicker"   title="请选择" name="customGrade[]" id="customGrade" multiple>
            {foreach from=$customGrade key=key  item=info}
            <option class="u144_input_option" {if !empty($query.customGrade) && in_array($key,$query.customGrade)}selected="selected"{/if} value="{$key}">{$info}</option>
            {/foreach}
        </select>
    </div>
</div>
<div class="form-group col-lg-3 ui-select">
    <label for="exampleInputName2"  class="col-sm-4 control-label">案件标识号:</label>
    <div class="col-sm-7">
        <input type="text" class="form-control noempty col-sm-4" value="{$query.batshId}" name="batshId" id="batshId" placeholder="请输入~">
    </div>
</div>
<div class="form-group col-lg-3 ui-select">
    <label for="exampleInputName2"  class="col-sm-4 control-label">导入批次ID:</label>
    <div class="col-sm-7">
        <input type="text" class="form-control noempty col-sm-4"  value="{if !empty($query.importRecordId)}{$query.importRecordId}{/if}" name="importRecordId" id="importRecordId" placeholder="请输入~">
    </div>
</div>
</div>
<div class="form_row start-hide col-lg-12" data-isshow="{if $is_show == 1}true{else}false{/if}" {if $is_show == 1}style="padding:0px;"{else}style="padding:0px;display:none;"{/if}>
<div class="form-group col-lg-3 ui-select">
    <label for="exampleInputName2"  class="col-sm-4 control-label">批次名称:</label>
    <div class="col-sm-7">
        <input type="text" class="form-control noempty col-sm-4"  value="{if !empty($query.batchName)}{$query.batchName}{/if}" name="batchName" id="batchName" placeholder="请输入~">
    </div>
</div>
<div class="form-group col-lg-3 ui-select">
    <label for="exampleInputName2"  class="col-sm-4 control-label">案件合同号:</label>
    <div class="col-sm-7">
        <input type="text" class="form-control noempty col-sm-4"  value="{if !empty($query.contractNo)}{$query.contractNo}{/if}" name="contractNo" id="contractNo" placeholder="请输入~">
    </div>
</div>
<div class="form-group col-lg-3 ui-select">
    <label for="exampleInputName2"  class="col-sm-4 control-label">案件类型:</label>
    <div class="col-sm-7">
        <select class="form-control"   title="请选择"  name="caseType" id="caseType">
            <option class="u144_input_option" value="0">请选择</option>
            {foreach from=$caseType key=key  item=info}
            <option class="u144_input_option" {if !empty($query.caseType) &&  $key ==  $query.caseType }selected="selected"{/if} value="{$key}">{$info}</option>
            {/foreach}
        </select>
    </div>
</div>
<div class="ui-select"></div>

</div>

<div class="form_row col-lg-12" style="padding:0px;">
    <div class="form-group col-lg-4 ui-select specail">
        <div class="col-lg-4">
            <button style="width:auto;" type="submit" class="btn btn-primary col-lg-8 shousuoBtn" name="submit" value="1"><span class="nav-icon glyphicon glyphicon-search" aria-hidden="true" style="margin-right: 2px"></span>查询</button>
        </div>
        <div class="col-lg-4">
            <button style="width:auto;" type="submit" class="btn btn-default col-lg-8" name="submit" value="3"><span class="nav-icon glyphicon glyphicon-refresh" aria-hidden="true" style="margin-right: 2px"></span>重置</button>
        </div>
        <div class="col-lg-4">
            <a style="width:auto;" type="button" href="javascript:;" class="btn btn-default col-lg-8 show-more-btn">》更多</a>
        </div>
        <div class="col-lg-4">
            <button  style="width:auto;" class="btn btn-info col-lg-8 data_upload"><span class="nav-icon glyphicon glyphicon-download-alt" aria-hidden="true" style="margin-right: 2px"></span>导出</button>
        </div>
    </div>
    <div class="ui-select"></div>
    <div class="ui-select"></div>
    <div class="ui-select"></div>
</div>
</form>
<div style="width: 95%;
          margin: 0 auto;
          display: flex;
          flex-direction: column;
          overflow-x: scroll;">
    <table class="table table-striped table-bordered table-hover text-nowrap" id="tab">
        <thead>
        <tr>
            <th>案件号</th>
            <th>调解部门</th>
            <th>资产方</th>
            <th>当事人</th>
            <th>调解号</th>
            <th>调解员</th>
            <th>批次名称</th>
            <th>案件类型</th>
            <th>纠纷类型</th>
            <th>系统状态</th>
            <th>案件状态</th>
            <th>调解状态</th>
            <th>案件标识号</th>
            <th>用户标签</th>
            <th>用户等级</th>
            <th>最近修改时间</th>
            <th>案件到期时间</th>
            <th class="fix-ele">操作</th>
        </tr>
        </thead>
        <tbody>
        {if $arrList}
        {foreach from=$arrList key=key item=item name=foo}
        <tr>
            <td>{$item.id}</td>
            <td>{$mediationOrgan[$item.mediationOrganId]['name']}</td>
            <td>{$assets[$item.assetsId]['name']}</td>
            <td>{$item.litigantName}</td>
            <td>{$item.mediationNum}</td>
            <td>{$item.mediatorName}</td>
            <td>{$item.batchName}</td>
            <td><p
                    {if $item.caseType == 2}
                    style="color: #77c87a;background-color:#ecf5ec;padding: 3px 4px;border-radius:5px"
                    {elseif $item.caseType == 3}
                    style="color: #FF5460;background-color:#fff4f9;padding: 3px 4px;border-radius:5px"
                    {else}
                    style="color: #03A9F4;background-color:#e2eef6;padding: 3px 4px;border-radius:5px"
                    {/if}
                >{$caseType[$item.caseType]}</p></td>
            <td>{$disputeType[$item.$disputeType]}</td>
            <td>{$sysStatus[$item.sysStatus]}</td>
            <td>{$caseStatusArr[$item.caseStatus]}</td>
            <td>{$mediateStatus[$item.mediateStatus]}</td>
            <td>{if $item.batshId}{$item.batshId}{/if}</td>
            <td>{$customLabel[$item.customLabel]}</td>
            <td>{$customGrade[$item.customGrade]}</td>
            <td>{$item['updateTime']|date_format:"%Y/%m/%d %H:%M:%S"}</td>
            <td>{$item['entrustExpireTime']|date_format:"%Y/%m/%d %H:%M:%S"}</td>
            <td class="fix-ele"><a href="/caseInfo/caseInfo?caseId={$item.id}">查看</a></td>
        </tr>
        {/foreach}
        {/if}
        </tbody>
    </table>
</div>
<div class="clearfix pad-no text-nowrap" style="margin-top: 20px;">
    {include file="base/pagenav.html"  action="/caserecord/index" pagenum=$curPageNum inline}
    <select class="form-control" id="paglimit" style="float:right;margin:0 10px;width: auto;margin-top: -5px;">
        <option value="limit=10" {if $query.limit==10}selected="selected"{/if}>10条/页</option>
        <option value="limit=20" {if $query.limit==20}selected="selected"{/if}>20条/页</option>
        <option value="limit=50" {if $query.limit==50}selected="selected"{/if}>50条/页</option>
        <option value="limit=100" {if $query.limit==100}selected="selected"{/if}>100条/页</option>
    </select>
    {if $tj}
        <span style="float:right;">欠款总额 {number_format($debtTotal,2)} 元，本金总额 {number_format($debtAmount,2)} 元，{if $groupTotal}共 {$groupTotal} 人，{/if}共 {$totalnum} 件</span>
    {else}
        <span style="float:right;">共 {$totalnum} 件</span>
    {/if}
</div>
</div>
</div>
{/block}
{block name="page_scripts"}
{*    <script type="text/javascript" src="/js/mediation/caserecord/index.min.js" init="mediation/caserecord/index"></script>*}
<script type="text/javascript">


    $(".data_upload").on("click",function(){
        var is_down =confirm('请确认是否下载？\n'+ '下载时间可能比较慢,点击后请耐心等待!') ;
        if(is_down){
            $("#form-ele").attr('action','/caserecord/exportinfo');
            $("#form-ele").submit();

            // $("#form-ele").attr('action','');


        }

    });

    $(".shousuoBtn").on("click",function(){
        $("#form-ele").attr('action','');
        $("#form-ele").submit();

    });
    function GetQueryString(name){
        var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);

        if(r!=null)return  unescape(r[2]); return null;
    }
    $('body').on('change','#paglimit', function(){

        var mediationOrganId = GetQueryString('mediationOrganId');
        var paglimit = GetQueryString('limit');
        var val =  $(this).val();

        if(!mediationOrganId){
            if(!paglimit){
                window.location = window.location.href+'?'+val;
            } else{
                window.location = window.location.href.replace('limit='+paglimit,val);
            }
        }else{
            if(!paglimit){
                window.location = window.location.href+'&'+val;
            } else{
                window.location = window.location.href.replace('limit='+paglimit,val);
            }
        }
    })

</script>

{/block}
